Processing method and mobile device

ABSTRACT

A processing method, which includes receiving a photographing instruction in order to trigger a camera to photograph a target document, identifying four sides of a document image corresponding to the target document, determining a first included angle corresponding to the document image, where the first included angle represents an inclination degree of the document image relative to the target document, triggering the camera to reset a focus location in a direction of far-end content in the document image, and taking n pictures when the first included angle is greater than a preset threshold, applying geometric correction to the pictures obtained through photographing, outputting one of the pictures to which geometric correction has been applied. Hence, the method significantly increase definition of the far-end content in the document image, and improve correction quality of the document image.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a U.S. National Stage of International PatentApplication No. PCT/CN2016/098762 filed on Sep. 12, 2016, which ishereby incorporated by reference in its entirety.

TECHNICAL FIELD

The present invention relates to the field of image processingtechnologies, and in particular, to a processing method and a mobiledevice.

BACKGROUND

A user may take a photograph or record a video by using a mobile devicehaving a photographing function (for example, a camera, a mobile phone,a wearable device, or a network camera). For example, in a conferenceroom, people may photograph, at any time, information on a whiteboard, aslide, a document, or another material by using a mobile phone, and donot need to write down the information. This is quite convenient.

However, when such a mobile device is used to photograph an object,there is usually a specific included angle between an image plane of acamera and a photographed plane due to limitation of a factor such as aphotographing distance or angle. This leads to relatively large imagedistortion. For example, a to-be-photographed object that is actuallyrectangular is possibly distorted into an arbitrary quadrilateral, suchas a trapezoid. Such distortion is referred to as oblique distortion.

FIG. 1A and FIG. 1B show document images that are corresponding to arectangular document and that have oblique distortion. Referring to FIG.1A, the distorted document image is photographed at a relatively smallinclination angle. The document image shown in FIG. 1A is an arbitraryquadrilateral rather than a rectangle. In addition, a font of a far-endcharacter is smaller than a font of a near-end character. Worse,referring to FIG. 1B, the distorted document image is photographed at arelatively large inclination angle. Compared with the document imageshown in FIG. 1A, a shape of the document image shown in FIG. 1B is evenless like a rectangle. In addition, a far-end character in the documentimage shown in FIG. 1B is quite fuzzy and is difficult to recognize.

With respect to oblique distortion, some existing smartphones provide adocument correction function in a photographing function.

The document correction function can well correct a distorted documentimage that is obtained through photographing at a relatively smallinclination angle (for example, less than 15°). However, for a distorteddocument image obtained through photographing at a relatively largeinclination angle (for example, greater than 50°), far-end content of adocument image corrected by using the existing document correctionfunction has relatively low definition.

SUMMARY

Embodiments of the present invention provide a processing method and amobile device, so as to significantly increase definition of far-endcontent in a document image and improve correction quality of thedocument image.

According to a first aspect, a processing method is provided. Theprocessing method is applied to a mobile device, and includes:receiving, by the mobile device, a photographing instruction;determining, through edge detection, four sides of a document imagecorresponding to a target document in a preview box of the mobiledevice; determining, based on the four sides, a first included anglecorresponding to the document image; if the first included angle isgreater than a preset threshold, triggering a camera to reset a focuslocation in a direction close to far-end content in the document image,and take n pictures (n is an integer not less than 1); applyinggeometric correction to at least one of the n pictures obtained throughphotographing; and using, as output in response to the photographinginstruction, one of the at least one picture to which geometriccorrection has been applied.

Specifically, the first included angle may be used to represent aninclination degree of the document image relative to the targetdocument. The first included angle is positively correlated with aninclination angle of an image plane of the camera relative to the targetdocument.

In specific implementation, the first included angle may be an includedangle formed between two lateral sides adjacent to a main side of aquadrilateral. Herein, the main side is a side closest to the camera inthe four sides. It should be noted that the first included angle mayalternatively be another angle corresponding to the document image, andis not limited to the included angle formed between the two lateralsides adjacent to the main side, provided that the first included anglecan reflect an inclination degree of the image plane of the camerarelative to the target document.

In this embodiment of the present invention, the mobile device maydetermine the first included angle according to the following severalimplementations.

In a first implementation, the mobile device may obtain lengths of thefour sides k₁, k₂, k₃, and k₄, where k₁ and k₃ are opposite sides,k₁/k₃≥1, k₂ and k₄ are opposite sides, and k₂/k₄≥1. Then, the mobiledevice calculates side ratios of the two pairs of opposite sides: k₁/k₃and k₂/k₄. The mobile device determines k₁ as a main side if k₁/k₃ isgreater than k₂/k₄, or determines k₂ as a main side if k₂/k₄ is greaterthan k₁/k₃. Finally, the mobile device may determine, as the firstincluded angle, an included angle formed by intersection of two lateralsides of the determined main side.

In a second implementation, the mobile device may obtain lengths of thefour sides k₁, k₂, k₃, and k₄, where k₁ and k₃ are opposite sides, andk₂ and k₄ are opposite sides. The mobile device calculates a secondincluded angle formed between the opposite sides k₁ and k₃ and a thirdincluded angle formed between the opposite sides k₂ and k₄. Finally, themobile device may determine, as the first included angle, the larger ofthe second included angle and the third included angle.

In this embodiment of the present invention, the mobile device may reseta photographing focus according to the following severalimplementations.

In some embodiments, the mobile device may calculate an angle differencebetween the first included angle and the preset threshold (for example,50°), then determine a moving distance d of the focus based on the angledifference, and finally, move the focus the moving distance d in adirection close to a far end.

For example, the mobile device moves the focus one unit quantity towardthe far-end content each time when the angle difference increases by 5°.In specific implementation, the unit quantity may be a physical quantitythat represents a distance, for example, 1 centimeter. The unit quantitymay be alternatively represented by using a pixel value, for example, 80dpi is one unit quantity. It should be noted that the moving distance dof the focus may alternatively be a fixed value.

In some embodiments, the mobile device may move, on a central axis ofthe document image, the focus toward a far end. H is a length of thecentral axis. The mobile device may finally set the focus location to alocation that is at a distance of r*H from the main side, where rrepresents a ratio, and 0<r<1. In specific implementation, a largerfirst included angle may indicate a larger ratio r. That is, largeroblique distortion indicates a shorter distance between the focuslocation and the far end of the document image. This can better improvefar-end definition for a seriously distorted document image.

In actual application, the ratio r may alternatively be a fixed value,for example, r=2/3. That is, regardless of an oblique distortion degree,the focus location is set by default to a location that is at a distanceof 2H/3 from the main side.

In this embodiment of the present invention, after resetting the focuslocation, the mobile device may take a picture and apply imagecorrection according to the following several implementations, toimprove image correction quality.

In an embodiment, after resetting the focus location, the mobile devicemay take one picture (n=1). Then, the mobile device may apply geometriccorrection to the picture obtained through photographing, to restore ageometric ratio of a document image in the picture.

In an embodiment, after resetting the focus location, the mobile devicemay take a plurality of pictures (n≥2), and then apply geometriccorrection to the plurality of pictures obtained through photographing.

In an implementation, to further improve far-end definition of thedocument image, image segmentation and image splicing operations may befurther performed after geometric correction is applied to the pictureobtained through photographing. Specific steps may be as follows:

Step 1: Divide, into m image blocks, each of at least two of the n (n≥2)pictures to which geometric correction has been applied, where m≥2, andm is a positive integer.

Step 2: With respect to a same image block, select, from the at leasttwo pictures, an image block with highest definition as a to-be-splicedimage block.

Finally, m selected to-be-spliced image blocks are spliced into onepicture, and the picture obtained through splicing is used as the outputin response to the photographing instruction.

In another implementation, to further improve far-end definition of thedocument image, image segmentation and image splicing operations may befurther performed before geometric correction is applied to the pictureobtained through photographing. Specific steps may be as follows:

Step 1: Divide, into m image blocks, each of at least two of the n (n≥2)pictures obtained through photographing, where m≥2, and m is a positiveinteger.

Step 2: With respect to a same image block, select, from the at leasttwo pictures, an image block with highest definition as a to-be-splicedimage block.

Step 3: Splice m selected to-be-spliced image blocks into one picture.

Finally, geometric correction is applied to the picture obtained throughsplicing, and the picture to which geometric correction has been appliedis used as the output in response to the photographing instruction.

To avoid impairment of near-end definition of the document image whileimproving the far-end definition of the document image, this embodimentof the present invention provides the following implementations.

In some embodiments, the mobile device may move the photographing focusa plurality of times in the direction close to the far-end content inthe document image, sequentially obtain, through photographing, the n(n≥2) pictures in a process of moving the focus, and then applygeometric correction and perform the image segmentation and imagesplicing operations by using the pictures obtained throughphotographing.

It can be understood that, when a picture is taken in an initial phaseof focus moving, the focus is still relatively close to near-endcontent, and image definition near the near-end content is stillrelatively high. Therefore, when the image segmentation and imagesplicing operations are performed on the plurality of pictures obtainedthrough photographing, a to-be-spliced image block of the near-endcontent may be selected from the picture taken in the initial phase. Inthis way, near-end definition of a picture obtained through splicing isless affected by focus moving.

In some embodiments, before resetting the location of the photographingfocus, the mobile device may further take one or more pictures.

It can be understood that, because a picture has been taken before thephotographing focus is reset, near-end definition of the picture takenbefore the photographing focus is reset is not affected by focus moving,and the definition is quite high. Therefore, when the image segmentationand image splicing operations are performed by using all picturesobtained through photographing (including the picture taken before focusresetting and the n pictures), a to-be-spliced image block of near-endcontent may be selected from the picture taken before focus resetting.In this way, near-end definition of a picture obtained through splicingis not affected by focus moving.

According to the method described in the first aspect, when the documentimage has relatively serious oblique distortion, the focus is reset inthe direction close to the far-end content in the document image, andthe picture is taken. This can not only restore a geometric ratio of thedocument image, but also significantly increase definition of thefar-end content in the document image and improve correction quality ofthe document image.

According to a second aspect, a processing method is provided. Theprocessing method includes: receiving, by a mobile device, aphotographing instruction; determining, through edge detection, foursides of a document image corresponding to a target document in apreview box of the mobile device; determining, based on the four sides,a first included angle corresponding to the document image, if the firstincluded angle is greater than a preset threshold, triggering a camerato take k pictures (k≥2, and k is a positive integer); applying imagecorrection to the k pictures obtained through photographing; and using,as output in response to the photographing instruction, one pictureobtained through image correction.

Specifically, image correction may be used for improving far-enddefinition of the document image, so that far-end definition of thepicture obtained through image correction is higher than the far-enddefinition that the document image has before image correction isapplied.

In an implementation, a specific process in which the mobile deviceperforms image correction by using the k pictures may be as follows.

Step 1: Apply geometric correction to at least two of the k pictures.

Step 2: Divide, into m image blocks, each of the at least two picturesto which geometric correction has been applied, where m≥2, and m is apositive integer.

Step 3: With respect to a same image block, select, from the at leasttwo pictures, an image block with highest definition as a to-be-splicedimage block.

Finally, m selected to-be-spliced image blocks are spliced, and onepicture obtained through splicing is used as the output in response tothe photographing instruction.

In another implementation, a specific process in which the mobile deviceperforms image correction by using the k pictures may be as follows:

Step 1: Divide each of at least two of the k pictures into m imageblocks, where m≥2, and m is a positive integer.

Step 2: With respect to a same image block, select, from the at leasttwo pictures, an image block with highest definition as a to-be-splicedimage block.

Step 3: Perform image splicing on m selected to-be-spliced image blocks,and use, as the output, one picture obtained through splicing.

Finally, geometric correction is applied to the one picture obtainedthrough splicing, and the picture to which geometric correction has beenapplied is used as the output in response to the photographinginstruction.

Specifically, for specific implementation of determining the firstincluded angle by the mobile device, refer to related content in themethod described in the first aspect. Details are not described hereinagain.

According to the method described in the second aspect, when the cameratakes the k pictures, slight jitter of the camera causes the k picturesobtained through photographing to present different far-end definition.Far-end content of some of the pictures is clearer.

Therefore, when image segmentation and image splicing operations areperformed by using the k pictures obtained through photographing, animage block with highest definition may be selected from the k picturesas a to-be-spliced image block. This can improve definition of far-endcontent in the document image.

With reference to the first aspect, or with reference to the secondaspect, in some embodiments, if the mobile device determines that thefirst included angle is less than the preset threshold, the mobiledevice may apply geometric correction to the document image.

It can be understood that a far-end fuzziness phenomenon of the documentimage is not obvious when oblique distortion is not serious. In thiscase, a geometric ratio of the document image may be restored by usinggeometric correction only.

According to a third aspect, a processing method is provided. Theprocessing method includes: receiving, by a mobile device, aphotographing instruction; determining that an included angle formedbetween two lateral sides adjacent to a main side in four sides of adocument image is greater than a preset threshold; triggering a camerato take k pictures (k≥2, and k is a positive integer); using at leasttwo of the k pictures as input, and applying geometric correction orimage correction to the at least two pictures; and using, as output inresponse to the photographing instruction, one picture obtained throughimage correction. Herein, the main side is a side closest to the camerain the four sides.

Specifically, the image correction may include: applying geometriccorrection to the at least two pictures, and dividing, into m imageblocks (m≥2, and m is a positive integer), each of the at least twopictures to which geometric correction has been applied; with respect toa same image block, selecting, from the at least two pictures, an imageblock with highest definition as a to-be-spliced image block; andsplicing m selected to-be-spliced image blocks into one picture, andusing, as the output in response to the photographing instruction, thepicture obtained through splicing.

In some embodiments, the image correction may alternatively include:dividing each of the at least two pictures into m image blocks (m≥2, andm is a positive integer); with respect to a same image block, selecting,from the at least two pictures, an image block with highest definitionas a to-be-spliced image block; splicing m selected to-be-spliced imageblocks into one picture; and applying geometric correction to thepicture obtained through splicing, and using, as the output in responseto the photographing instruction, the picture to which geometriccorrection has been applied.

It should be noted that, for how to determine that the included angleformed between the two lateral sides adjacent to the main side in thefour sides of the document image is greater than the preset threshold,reference may be made to related descriptions about how to determinewhether the first included angle is greater than the preset threshold inthe first aspect. Details are not described herein again.

According to a fourth aspect, a processing method is provided. Theprocessing method includes: receiving, by a mobile device, aphotographing instruction; determining that an included angle formedbetween two lateral sides adjacent to a main side in four sides of adocument image is greater than a preset threshold; taking s pictures (sis a positive integer); taking q pictures (q is a positive integer)after resetting a location of a photographing focus; using, as input, atleast two of the s+q pictures obtained through photographing, andapplying geometric correction or image correction to the at least twopictures; and using, as output in response to the photographinginstruction, one picture obtained through image correction.

Specifically, the image correction may include: applying geometriccorrection to the at least two pictures, and dividing, into m imageblocks (m≥2, and m is a positive integer), each of the at least twopictures to which geometric correction has been applied; with respect toa same image block, selecting, from the at least two pictures, an imageblock with highest definition as a to-be-spliced image block; andsplicing m selected to-be-spliced image blocks into one picture, andusing, as the output in response to the photographing instruction, thepicture obtained through splicing.

In some embodiments, the image correction may alternatively include:dividing each of the at least two pictures into m image blocks (m≥2, andm is a positive integer); with respect to a same image block, selecting,from the at least two pictures, an image block with highest definitionas a to-be-spliced image block; splicing m selected to-be-spliced imageblocks into one picture; and applying geometric correction to thepicture obtained through splicing, and using, as the output in responseto the photographing instruction, the picture to which geometriccorrection has been applied.

It should be noted that, for details about resetting the location of thephotographing focus, reference may be made to related content in thefirst aspect, and details are not described herein again. For how todetermine that the included angle formed between the two lateral sidesadjacent to the main side in the four sides of the document image isgreater than the preset threshold, reference may be made to relateddescriptions about how to determine whether the first included angle isgreater than the preset threshold in the first aspect, and details arenot described herein again.

According to a fifth aspect, a processing method is provided. Theprocessing method includes: receiving, by a mobile device, aphotographing instruction; determining that an included angle formedbetween two lateral sides adjacent to a main side in four sides of adocument image is greater than a preset threshold; taking n pictures (nis a positive integer) after resetting a location of a photographingfocus; using, as input, at least one of the n pictures obtained throughphotographing, and applying geometric correction to the at least onepicture; and using, as output in response to the photographinginstruction, one picture to which geometric correction has been applied.

Specifically, when geometric correction is applied, image segmentationand image splicing operations may further be performed to furtherimprove far-end definition of the document image. For details, refer tospecific implementation of further improving the far-end definition ofthe document image in the first aspect.

Further, to avoid impairment of near-end definition of the documentimage while improving the far-end definition of the document image, insome embodiments, the mobile device may move the photographing focus aplurality of times in a direction close to far-end content in thedocument image, sequentially obtain, through photographing, the n (n≥2)pictures in a process of moving the focus, and then perform imagecorrection by using the plurality of pictures obtained throughphotographing.

It should be noted that, for how to determine that the included angleformed between the two lateral sides adjacent to the main side in thefour sides of the document image is greater than the preset threshold,reference may be made to related descriptions about how to determinewhether the first included angle is greater than the preset threshold inthe first aspect. Details are not described herein again.

According to a sixth aspect, a processing method is provided. Theprocessing method includes: receiving, by a mobile device, aphotographing instruction; determining an included angle formed betweentwo lateral sides adjacent to a main side in four sides of a documentimage; and if the included angle is greater than a preset threshold,using the processing method described in the fourth aspect, the fifthaspect, or the sixth aspect; or if the included angle is not greaterthan a preset threshold, taking one picture, and applying geometriccorrection to the picture.

According to a seventh aspect, a mobile device is provided, and themobile device is configured to implement the method described in thefirst aspect, the fourth aspect, or the fifth aspect. The mobile devicemay include a user input apparatus, a processor, and a camera. The userinput apparatus is configured to receive a photographing instruction.The camera is configured to obtain a document image of a targetdocument. The processor is configured to determine, through edgedetection, four sides of the document image corresponding to the targetdocument in a preview box of the mobile device. The processor is furtherconfigured to determine, based on the four sides, a first included anglecorresponding to the document image. The processor is further configuredto: determine whether the first included angle is greater than a presetthreshold; and if the first included angle is greater than the presetthreshold, trigger the camera to reset a focus location in a directionclose to far-end content in the document image and take n pictures (n isan integer not less than 1). The processor is further configured toapply geometric correction to at least one of the n pictures obtainedthrough photographing, and use, as output in response to thephotographing instruction, one of the at least one picture to whichgeometric correction has been applied.

Specifically, the first included angle may be used to represent aninclination degree of the document image relative to the targetdocument. The first included angle is positively correlated with aninclination angle of an image plane of the camera relative to the targetdocument. For a definition and a determining manner of the firstincluded angle, refer to related content in the first aspect. Detailsare not described herein again.

According to an eighth aspect, a mobile device is provided, and themobile device is configured to implement the method described in thesecond aspect or the third aspect. The mobile device may include a userinput apparatus, a processor, and a camera. The user input apparatus isconfigured to receive a photographing instruction. The camera isconfigured to obtain a document image of a target document. Theprocessor is configured to determine, through edge detection, four sidesof the document image corresponding to the target document in a previewbox of the mobile device. The processor is further configured todetermine, based on the four sides, a first included angle correspondingto the document image. The processor is further configured to: determinewhether the first included angle is greater than a preset threshold, andif the first included angle is greater than the preset threshold,trigger the camera to take k pictures (k≥2, and k is a positiveinteger). The processor is further configured to apply image correctionby using the k pictures taken by the camera, and use, as output inresponse to the photographing instruction, one picture obtained throughimage correction. Far-end content in the picture obtained through imagecorrection is clearer than far-end content in the document image.

Specifically, the first included angle may be used to represent aninclination degree of the document image relative to the targetdocument. The first included angle is positively correlated with aninclination angle of an image plane of the camera relative to the targetdocument. For a definition and a determining manner of the firstincluded angle, refer to related content in the first aspect. Detailsare not described herein again.

According to a ninth aspect, a mobile device is provided, and the mobiledevice is configured to implement the method described in the sixthaspect. The mobile device may include a user input apparatus, aprocessor, and a camera. The user input apparatus is configured toreceive a photographing instruction. The camera is configured to obtaina document image of a target document. The processor is configured todetermine an included angle formed between two lateral sides adjacent toa main side in four sides of the document image. If the included angleis greater than a preset threshold, the processor performs theprocessing method described in the fourth aspect, the fifth aspect, orthe sixth aspect. If the included angle is not greater than a presetthreshold, the processor triggers the camera to take one picture, andapplies geometric correction to the picture.

According to a tenth aspect, a mobile device is provided. The mobiledevice includes one or more processors, a memory, a bus system, atransceiver, and one or more programs. The processor, the memory, andthe transceiver are connected to each other by using the bus system. Theone or more programs are stored in the memory. The one or more programsinclude an instruction. When executed by the portable electronic device,the instruction causes the portable electronic device to perform themethod described in any one of the first aspect to the sixth aspect.

According to an eleventh aspect, a mobile device is provided, and themobile device includes a functional unit configured to perform themethod described in the first aspect, the fourth aspect, or the fifthaspect.

According to a twelfth aspect, a mobile device is provided, and themobile device includes a functional unit configured to perform themethod described in the second aspect or the third aspect.

According to a thirteenth aspect, a mobile device is provided, and themobile device includes a functional unit configured to perform themethod described in the sixth aspect.

According to a fourteenth aspect, a readable nonvolatile storage mediumthat stores a computer instruction is provided, and the computerinstruction is executed by the mobile device described in the seventhaspect, to implement the method described in the first aspect, thefourth aspect, or the fifth aspect.

According to a fifteenth aspect, a readable nonvolatile storage mediumthat stores a computer instruction is provided, and the computerinstruction is executed by the mobile device described in the eighthaspect, to implement the method described in the second aspect or thethird aspect.

According to a sixteenth aspect, a readable nonvolatile storage mediumthat stores a computer instruction is provided, and the computerinstruction is executed by the mobile device described in the ninthaspect, to implement the method described in the sixth aspect.

According to a seventeenth aspect, a computer readable storage mediumthat stores one or more programs is provided. The one or more programsinclude an instruction. When executed by a portable electronic device,the instruction causes the portable electronic device to perform themethod described in any one of the first aspect to the sixth aspect.

According to an eighteenth aspect, a graphical user interface on amobile device is provided. The mobile device includes a display, amemory, a plurality of application programs, and one or more processorsconfigured to execute one or more programs stored in the memory. Thegraphical user interface includes a user interface displayed inperforming the method described in any one of the first aspect to thesixth aspect.

Implementation of the embodiments provided in the present invention cansignificantly increase the definition of the far-end content in thedocument image, and improve correction quality of the document image.

BRIEF DESCRIPTION OF DRAWINGS

To describe the technical solutions in the embodiments of the presentinvention more clearly, the following briefly describes the accompanyingdrawings required for describing the embodiments.

FIG. 1A and FIG. 1B are schematic diagrams of document images that haveoblique distortion when a target document is photographed:

FIG. 2A is a schematic diagram of a photographing scenario withoutoblique distortion;

FIG. 2B is a schematic diagram of a photographing scenario with obliquedistortion;

FIG. 3 is a schematic diagram of a geometric correction method relatedto an embodiment of the present invention:

FIG. 4 is a schematic flowchart of a processing method according to anembodiment of the present invention;

FIG. 5 is a schematic diagram of a relationship between obliquedistortion and a geometric shape of a document image;

FIG. 6A is a schematic diagram of a method for determining a firstincluded angle according to an embodiment of the present invention;

FIG. 6B is a schematic diagram of another method for determining a firstincluded angle according to an embodiment of the present invention;

FIG. 7 is a schematic diagram of an optional embodiment of a firstincluded angle according to an embodiment of the present invention;

FIG. 8A and FIG. 8B are schematic diagrams of focus location resettingaccording to an embodiment of the present invention;

FIG. 9 is a schematic diagram of a method for performing imagecorrection by using a plurality of pictures according to an embodimentof the present invention:

FIG. 10 is a schematic diagram of another focus moving method accordingto an embodiment of the present invention;

FIG. 11 is a schematic flowchart of another processing method accordingto an embodiment of the present invention;

FIG. 12 is a schematic flowchart of still another processing methodaccording to an embodiment of the present invention;

FIG. 13 is a schematic structural diagram of a mobile device accordingto an embodiment of the present invention;

FIG. 14 is a schematic diagram of cooperative interaction of parts inthe mobile device according to the embodiment in FIG. 13; and

FIG. 15 is a schematic structural diagram of another mobile deviceaccording to an embodiment of the present invention.

DESCRIPTION OF EMBODIMENTS

Terms used in an implementation part of the present invention are merelyintended to explain specific embodiments of the present invention, butare not intended to limit the present invention.

For ease of understanding of the embodiments of the present invention,oblique distortion and geometric correction related to the embodimentsof the present invention are described first.

FIG. 2A and FIG. 2B show a photographing scenario without obliquedistortion and a photographing scenario with oblique distortion,respectively. A camera 20 may include a lens 21 and an imaging part 23.An optical center of the lens 21 is shown as a lens center S in thefigure. The imaging part 23 may be a CCD, a CMOS, or another imagingpart. A rectangular target document ABCD is placed on a horizontalreference plane T, and a document image corresponding to the targetdocument ABCD is on an image plane P. The image plane P is a plane onwhich the imaging part 23 is located.

In the photographing scenario without oblique distortion shown in FIG.2A, the image plane P of the camera 20 is parallel to the horizontalreference plane T on which the target document ABCD is located. Adocument image a₀b₀c₀d₀ finally imaged on the image plane P along anoptical path represented by a dashed line in FIG. 2A is also arectangle. In addition, a geometric ratio of the target document ABCD isreconstructed in the document image a₀b₀c₀d₀. The photographing scenarioshown in FIG. 2A is an ideal scenario of document photographing, andthere is no oblique distortion in the document image obtained throughphotographing.

In the photographing scenario with oblique distortion shown in FIG. 2B,the image plane P of the camera 20 is not parallel to the horizontalreference plane T on which the target document ABCD is located. There isan included angle α between the image plane P and the horizontalreference plane T. For a document image a₁b₁c₁d₁ imaged on the imagingplane P, a convergence effect is caused due to an optical perspectiveprinciple “an object looks big when near and small when in a distance”.That is, content closer to the lens 21 in the document image a₁b₁c₁d₁ islarger, and content farther from the lens 21 in the document imagea₁b₁c₁d₁ is smaller. The finally imaged document image a₁b₁c₁d₁ may be adistorted arbitrary quadrilateral, for example, a trapezoid.

It can be understood that, according to the optical perspectiveprinciple “an object looks big when near and small when in a distance”,content, for example, a word, closer to the lens 21 in the documentimage a₁b₁c₁d₁ is displayed in a larger size, and content, for example,a word, farther from the lens 21 in the document image a₁b₁c₁d₁ isdisplayed in a smaller size. That is, far-end content in the documentimage is fuzzier. In addition, a larger included angle α between theimage plane P and the target document ABCD indicates that obliquedistortion of the document image a₁b₁c₁d₁ is more serious, a shape ofthe document image a₁b₁c₁d₁ is less like a rectangle, and far-endcontent in the document image a₁b₁c₁d₁ is fuzzier.

It should be noted that a target document in the embodiments of thepresent invention may be a rectangular information presentation object,such as rectangular text, a rectangular whiteboard, a rectangular slide,or a rectangular display screen configured to display information.

The following describes geometric correction related to the embodimentsof the present invention. A precondition for the geometric correctionis: In an image plane coordinate system, coordinates of four vertexes ofa document image that is possibly presented as an arbitraryquadrilateral are known. It should be understood that lengths anddirections of four sides of the document image on an image plane can beidentified through edge detection.

Therefore, coordinates of all points (including the four vertexes) inthe document image can also be known.

In an embodiment of the present invention, referring to FIG. 3, a methodfor performing geometric correction on a document image is as follows:

Step 1: Estimate an original length-width ratio w/h of a target documentbased on four vertexes (a,b,c,d) of the document image. Due toprojection homography, a length-width ratio of a rectangularphotographed object corresponding to a known quadrilateral image can beestimated based on the image. For details, refer to US patent [U.S. Pat.No. 7,171,056]. Details are not described herein.

Step 2: Select four coordinate points (A, B, C, D) as four vertexes ofthe target document based on the estimated original length-width ratiow/h. The selected four coordinate points satisfy the originallength-width ratio. It should be noted that a rectangle constituted bythe four coordinate points merely reconstructs the length-width ratio ofthe target document, but is not necessarily equivalent to the targetdocument in area or size.

Step 3: Calculate a homography matrix H based on the four vertexes ofthe document image and the four vertexes of the target document. Thehomography matrix H is used to represent conversion between an imageplane coordinate system in which the document image is located and ahorizontal reference plane coordinate system in which the targetdocument is located. For details about how to solve the homographymatrix H, refer to US patent [U.S. Pat. No. 8,503,813]. Details are notdescribed herein.

Step 4: Perform projection transformation on the document image based onthe homography matrix H, to restore a geometric ratio of the documentimage. A projection transformation formula is {tilde over (m)}=sH{tildeover (M)}, where {tilde over (m)} represents a point in the documentimage, {tilde over (M)} represents a point in the target document,{tilde over (m)}=[x y 1]^(T)=[X Y 1 Z]^(T), and s is an arbitrary ratio.It can be learned that a point {tilde over (M)}, in the target document,to which an arbitrary point {tilde over (m)} in the document image iscorrespondingly projected can be known based on the homography matrix H.

That is, when the document image is known (that is, coordinates of allpoints in the document image are known), a rectangular document imagecan be restored by performing the foregoing process. The rectangulardocument image obtained through correction reconstructs the targetdocument in ratio. In specific implementation, a value of s may bedetermined based on an actual requirement, to set a size of thecorrected document image.

The embodiments of the present invention provide the processing method,so as to significantly increase definition of far-end content in thedocument image and improve correction quality of the document image.Herein, the far-end content is content, in the document image,relatively far from a camera.

A main principle used in the embodiments of the present inventionincludes: During photographing of a target document (ato-be-photographed object), if a relatively large inclination angle isfound between an image plane of a camera and the target document throughanalysis, the camera is triggered to enter a preset photographing mode.The preset photographing mode is used to improve a document imagefar-end fuzziness status caused by the relatively large inclinationangle.

For the preset photographing mode, the embodiments of the presentinvention provide the following two solutions:

Solution 1: The camera is triggered to move a photographing focus to thefar-end content in the document image and take a picture, and finally,image correction is applied to the picture obtained throughphotographing, to obtain a corrected document image.

Solution 2: The camera is triggered to take a plurality of pictures, andimage correction is applied to the plurality of pictures, to obtain acorrected document image.

The following describes the processing method provided in theembodiments of the present invention with reference to the accompanyingdrawings.

FIG. 4 shows a processing method according to an embodiment of thepresent invention. In the embodiment in FIG. 4, during photographing ofa target document, if a relatively large inclination angle is foundbetween an image plane of a camera and the target document throughanalysis, the camera is triggered to enter the preset photographing modedescribed in the foregoing Solution 1. Steps S101 to S103 are performedby a mobile device or at least one processor in a mobile device. Themobile device includes but is not limited to a mobile phone, a camera, awearable device, or a network camera. The following providesdescriptions by using an example in which the mobile device is anexecution body.

S101: The mobile device receives a photographing instruction.

In specific implementation, the photographing instruction may betriggered by a user by pressing a specified physical button. Forexample, the user presses a photographing button on a side of the mobilephone to trigger photographing of the target document. The photographinginstruction may alternatively be triggered by a user by touching avirtual button. For example, after starting a photographing applicationprogram, the user touches a virtual shutter to trigger photographing ofthe target document. The photographing instruction may alternatively betriggered by a user in another application program (different from aphotographing application program). For example, when using a socialapplication, the user may trigger photographing of the target documentby sharing a photo. The examples are merely some implementations of thisembodiment of the present invention, and an implementation in actualapplication may be different from these implementations. This shall notconstitute any limitation.

S103: The mobile device determines, through edge detection, four sidesk₁, k₂, k₃, and k₄ of a document image corresponding to the targetdocument in a preview box of the mobile device. It should be understoodthat lengths and directions of the four sides of the document image onthe image plane can be identified through edge detection. Therefore,coordinates of all points (including four vertexes) in the documentimage can also be known.

S105: The mobile device determines, based on the four sides, a firstincluded angle corresponding to the document image, where the firstincluded angle may be used to represent an inclination degree of thedocument image relative to the target document. Specifically, the firstincluded angle is positively correlated with a photographing inclinationangle. The photographing inclination angle is an inclination angle ofthe image plane of the camera relative to the target document. Referringto content in FIG. 2A and FIG. 2B, it can be learned that the imageplane of the camera is a plane on which the document image is located,and the photographing inclination angle is the included angle α in FIG.2A and FIG. 2B.

S107: The mobile device determines whether the first included angle isgreater than a preset threshold. In specific implementation, the presetthreshold may be set based on experience. In actual use, bothphotographing light and optical configurations of the camera may affectsetting of the preset threshold.

Specifically, if the first included angle is greater than the presetthreshold, execution of step S109 is triggered; if the first includedangle is not greater than the preset threshold, execution of step S103is triggered.

S109: The mobile device triggers the camera to reset a focus location ina direction close to far-end content in the document image, and take npictures (n is an integer not less than 1). In this embodiment of thepresent invention, resetting the focus location may be moving aphotographing focus toward far-end content in the document image. Inthis way, definition of the far-end content can be improved.

It should be understood that, if the first included angle is greaterthan the preset threshold, for example, 70°, it indicates that obliquedistortion of the document image is relatively serious. In this case,the photographing mode described in the foregoing Solution 1 may betriggered, to improve a document image far-end fuzziness status.

S101: The mobile device applies geometric correction to at least one ofthe n pictures obtained through photographing, and uses, as output inresponse to the photographing instruction, one of the at least onepicture to which geometric correction has been applied. For specificimplementation of geometric correction, refer to content described inFIG. 3. Details are not described herein again. It can be understoodthat, because the picture is taken after the focus location is reset,far-end definition of the picture obtained through photographing isimproved in comparison with far-end definition of the document image.

S103: The mobile device applies geometric correction to the documentimage. For specific implementation of geometric correction, refer tocontent described in FIG. 3. It can be understood that a far-endfuzziness phenomenon of the document image is not obvious when obliquedistortion is not serious. In this case, a geometric ratio of thedocument image may be restored by using geometric correction only.

It should be noted that the mobile device in steps S101 to S103 may bereplaced by a processor in the mobile device, and details are notdescribed herein.

In this embodiment of the present invention, the first included anglemay be an included angle formed between two lateral sides adjacent to amain side of the quadrilateral. Herein, the main side is a side closestto the camera in the four sides.

For example, in a photographing scenario shown in FIG. 5, an opticalaxis of a camera 20 and a median line of a target document ABCD arelocated on a midperpendicular plane of the target document ABCD. Itshould be understood that a document image abcd obtained throughphotographing in a scenario in which an inclination angle α is 0 is arectangle, and all document images abcd obtained through photographingat different inclination angles α (α≠0) are distorted into an isoscelestrapezoid. A main side of the document image abcd is ad, and a firstincluded angle corresponding to the document image abcd is an includedangle β. It can be seen from FIG. 5 that a larger inclination angle αindicates a larger included angle β. That is, an included angle formedbetween two lateral sides adjacent to the main side may be used torepresent the inclination degree of the image plane of the camerarelative to the target image.

The following provides detailed descriptions about how to determine,based on the four sides, the first included angle corresponding to thedocument image.

In a first implementation, a method for determining the first includedangle by the mobile device may include: obtaining lengths of the foursides k₁, k₂, k₃, and k₄, where k₁ and k₃ are opposite sides, k₁/k₃≥1,k₂ and k₄ are opposite sides, and k₂/k₄≥1; calculating side ratios ofthe two pairs of opposite sides: k₁/k₃ and k₂/k₄; determining k₁ as themain side if k₁/k₃ is greater than k₂/k₄, or determining k₂ as the mainside if k₂/k₄ is greater than k₁/k₃; and determining, as the firstincluded angle, an included angle formed by intersection of the twolateral sides of the main side.

As shown in FIG. 6A, it is assumed that the main side determinedaccording to the foregoing implementation is bc. In this case, anincluded angle β formed by intersection of ab and cd is the firstincluded angle. A calculation process of the included angle β may be asfollows:

(1) According to a cosine formula of an included angle between twovectors, the following can be obtained:

${{\cos\;\theta\; 1} = \frac{\overset{\rightarrow}{ba} \cdot \overset{\rightarrow}{bc}}{{\overset{\rightarrow}{ba}} \cdot {\overset{\rightarrow}{bc}}}},{{{and}\mspace{14mu}\cos\;\theta\; 2} = \frac{\overset{\rightarrow}{cb} \cdot \overset{\rightarrow}{c\; d}}{{\overset{\rightarrow}{cb}} \cdot {\overset{\rightarrow}{c\; d}}}}$

In this way, an included angle θ1 and an included angle θ2 can becalculated.

(2) Then, according to a geometric theorem that a sum of interior anglesof a triangle is equal to 180°, the following can be calculated:β=180°−(θ1+θ2)

In a second implementation, a method for determining the first includedangle by the mobile device may include: obtaining lengths of the foursides k₁, k₂, k₃, and k₄, where k₁ and k₃ are opposite sides, and k₂ andk₄ are opposite sides; calculating a second included angle formedbetween the opposite sides k₁ and k₃ and a third included angle formedbetween the opposite sides k₂ and k₄; and determining, as the firstincluded angle, the larger of the second included angle and the thirdincluded angle.

As shown in FIG. 6B, it is assumed that the second included angle is βx,and the third included angle is βy. A calculation process of theincluded angle βx and the included angle βy may be as follows:

(1) According to a cosine formula of an included angle between twovectors, the following can be obtained:

${{\cos\;\theta\; 1} = \frac{\overset{\rightarrow}{ba} \cdot \overset{\rightarrow}{bc}}{{\overset{\rightarrow}{ba}} \cdot {\overset{\rightarrow}{bc}}}},{{\cos\;\theta\; 2} = \frac{\overset{\rightarrow}{cb} \cdot \overset{\rightarrow}{c\; d}}{{\overset{\rightarrow}{cb}} \cdot {\overset{\rightarrow}{c\; d}}}},{{{and}\mspace{14mu}\cos\;\theta\; 3} = {\frac{\overset{\rightarrow}{da} \cdot \overset{\rightarrow}{d\; c}}{{\overset{\rightarrow}{da}} \cdot {\overset{\rightarrow}{d\; c}}}.}}$

(2) Then, according to a geometric theorem that a sum of interior anglesof a triangle is equal to 180°, the following can be calculated:βx=180°−(θ2+θ3), and βy−180°−(θ1+θ2).

In a calculation result of FIG. 6B, if βx>βy, βx is determined as thefirst included angle, and the main side is cd; if βy>βx, βy isdetermined as the first included angle, and the main side is bc.

It should be noted that, because coordinates of the four vertexes of thedocument image can be determined through edge detection, vectors of allsides related to the foregoing cosine formulas are all known.

The following briefly describes principles related to the foregoing twoimplementations for determining the first included angle.

As shown in FIG. 5, if there is no oblique distortion (α=0), thedocument image abcd should reconstruct the target document ABCD ingeometric ratio, and the document image abcd should be a rectangle. Sidelength ratios corresponding to two pairs of opposite sides of thedocument image abcd should both be 1 (because bc=ad and ab=cd), andincluded angles formed by the two pairs of opposite sides should both be0 (because bc∥ad and ab∥cd).

As shown in FIG. 5, if there is oblique distortion (α≠0), a perspectivephenomenon that “an object looks big when near and small when in adistance” occurs.

In the document image abcd, an opposite-side length ratio deviates from1. In comparison with a side length ratio ab/cd between the two lateralsides (ab and cd) (ab/cd=1 in FIG. 5), a side length ratio between themain side ad and an opposite side be of the main side distorts moreseriously. Therefore, the main side may be determined from a pair ofopposite sides with a side length ratio that distorts more seriously,and a longer side in the pair of opposite sides is determined as themain side. Then, an included angle formed between two lateral sidesadjacent to the main side is determined as the first included angle. Inthe foregoing first implementation, such a phenomenon in an obliquedistortion scenario is applied.

In addition, in the document image abcd, the included angle formedbetween the two lateral sides (ab and cd) is greater than an includedangle formed between the main side ad and the opposite side be of themain side. Particularly, in FIG. 5, the included angle formed betweenthe main side ad and the opposite side be of the main side is 0. Inaddition, it can be seen from FIG. 5 that the included angle formedbetween the two lateral sides (ab and cd) increases with an increase inthe inclination degree. Therefore, the included angles formed by the twopairs of opposite sides may be separately calculated, and then, thelarger included angle is determined as the first included angle. In theforegoing second implementation, such a phenomenon in an obliquedistortion scenario is applied.

In some possible implementations, the first included angle in thisembodiment of the present invention may alternatively be another anglecorresponding to the arbitrary quadrilateral corresponding to thedocument image, and is not limited to the included angle formed betweenthe two lateral sides adjacent to the main side defined in the foregoingcontent, provided that the first included angle can reflect theinclination degree of the image plane of the camera relative to thetarget document.

For example, in FIG. 6, it is assumed that the main side is k₁. Thefirst included angle may alternatively be an included angle γ formed byintersection of two diagonals of the arbitrary quadrilateralcorresponding to the document image. From a comparison between FIG. (A)and FIG. (B), it can be learned that more serious oblique distortionindicates a larger included angle γ. It can be understood that k₁/k₃ inFIG. (B) is larger, and the ratio is more deviated from 1. Therefore,oblique distortion in FIG. (B) is more serious than oblique distortionin FIG. (A).

If the first included angle obtained through calculation in theforegoing manner is greater than the preset threshold (50°), the cameramay be triggered to enter the preset photographing mode described in theforegoing Solution 1, to improve a document image far-end fuzzinessstatus. The following provides detailed descriptions.

In the preset photographing mode described in the foregoing Solution 1,as shown in FIG. 8, the mobile device may reset the focus location inthe direction close to the far-end content in the document image. Itshould be understood that the definition of the far-end content can beimproved by moving the photographing focus to the far-end content in thedocument image.

As shown in FIG. 8A, during focus location resetting, a moving distanced of the focus may be correlated with the first included angle, so thatthe focus location is set based on different inclination degrees, toadapt to different degrees of far-end fuzziness in the document image.

In some embodiments, the mobile device may calculate an angle differencebetween the first included angle and the preset threshold (for example,50°), and then determine the moving distance d of the focus based on theangle difference. For example, the mobile device moves the focus oneunit quantity toward the far-end content each time when the angledifference increases by 5°. In specific implementation, the unitquantity may be a physical quantity that represents a distance, forexample, 1 centimeter. The unit quantity may be alternativelyrepresented by using a pixel value, for example, 80 dpi is one unitquantity. It should be noted that the moving distance d of the focus mayalternatively be a fixed value.

In some embodiments, the mobile device may move, on a central axis ofthe document image, the focus toward a far end. H is a length of thecentral axis. The focus location may be finally set to a location thatis at a distance of r*H from the main side, where r represents a ratio,and 0<r<1. As shown in FIG. 8B, it is assumed that the main side is k₁,and a dashed line represents the central axis of the document image. Itshould be understood that, usually, a smaller value of H indicates moreserious oblique distortion of the document image.

In specific implementation, a larger first included angle may indicate alarger ratio r. That is, larger oblique distortion indicates a shorterdistance between the focus location and the far end of the documentimage. This can better improve far-end definition for a seriouslydistorted document image. For example, if the first included angle is30°, the focus may be set at a location that is at a distance of 2H/3(r=2/3) from the main side k₁. If the first included angle is 50°, thefocus may be set at a location that is at a distance of 4H/5 (r=4/5)from the main side k₁. The examples are merely used to describe thisembodiment of the present invention, but shall not constitute anylimitation.

In actual application, the ratio r may alternatively be a fixed value,for example, r=2/3. That is, regardless of an oblique distortion degree,the focus location is set by default to a location that is at a distanceof 2H/3 from the main side k₁.

The following provides detailed descriptions about how to apply imagecorrection based on a picture obtained through photographing after focuslocation resetting, to improve image correction quality.

In an embodiment, after resetting the focus location, the mobile devicemay take one picture (n=1). Then, the mobile device may apply geometriccorrection by using the picture obtained through photographing, torestore a geometric ratio of a document image in the picture. Forspecific implementation of geometric correction, refer to contentdescribed in FIG. 3. Details are not described herein again. It can beunderstood that, because the picture is taken after the focus locationis reset, far-end definition of the document image is improved.

In an embodiment, after resetting the focus location, the mobile devicemay take a plurality of pictures (n≥2). Then, the mobile device mayapply image correction by using the plurality of pictures obtainedthrough photographing. In specific implementation, a quantity of theplurality of pictures may be correlated with an oblique distortiondegree of the document image. That is, more serious oblique distortionindicates that more pictures may be taken. How to determine a specificquantity of the plurality of pictures is not limited in this embodimentof the present invention. In some embodiments, the mobile device mayselect, from the plurality of pictures, one picture with highest far-enddefinition as output in response to the photographing instruction.

In an implementation, to further improve the far-end definition of thedocument image, if n≥2, the mobile device may further perform imagesegmentation and image splicing operations when applying geometriccorrection to the picture obtained through photographing. Specific stepsmay be as follows:

Step 1: Divide, into m image blocks, each of at least two pictures towhich geometric correction has been applied, where m≥2, and m is apositive integer.

Step 2: With respect to a same image block, select, from the at leasttwo pictures, an image block with highest definition as a to-be-splicedimage block.

Finally, m selected to-be-spliced image blocks are spliced into onepicture, and the picture obtained through splicing is used as the outputin response to the photographing instruction.

For example, as shown in FIG. 9, it is assumed that n=3 and m=9. First,geometric correction is applied to each of three pictures, to restore ageometric ratio of a document image in the picture. Then, for an imageblock whose number is 1, an image block with highest definition isselected from the three pictures as a to-be-spliced image block that isfinally used for image splicing. For example, for image blocks whosenumbers are 1 to 3, image blocks 1 to 3 in a picture 3 has highestdefinition, and therefore, the image blocks 1 to 3 in the picture 3 areselected as to-be-spliced image blocks. Similarly, image blocks 2, 3,and 6 in a picture 1 are selected as to-be-spliced image blocks, andimage blocks 5, 8, and 9 in the picture 1 are selected as to-be-splicedimage blocks. Finally, these to-be-spliced image blocks are spliced.

In another implementation, to further improve the far-end definition ofthe document image, if n≥2, the mobile device may further perform imagesegmentation and image splicing operations when applying geometriccorrection to the picture obtained through photographing. Specific stepsmay be as follows:

Step 1: Divide, into m image blocks, each of at least two of the n (n≥2)pictures obtained through photographing, where m≥2, and m is a positiveinteger.

Step 2: With respect to a same image block, select, from the at leasttwo pictures, an image block with highest definition as a to-be-splicedimage block.

Step 2: Splice m selected to-be-spliced image blocks into one picture.

Finally, geometric correction is applied to the picture obtained throughsplicing, and the picture to which geometric correction has been appliedis used as the output in response to the photographing instruction.

In some embodiments, the mobile device may alternatively perform imagesegmentation and image splicing operations in FIG. 9 on only a partialarea in the picture, for example, an area near the far-end content. Forexample, in FIG. 9, only image blocks 3, 6, and 9 with highestdefinition are selected from the three pictures, and image splicing isperformed on the selected image blocks 3, 6, and 9, to improvedefinition of far-end content.

It can be understood that the far-end definition of the document imagecan be further improved by performing both geometric correction and theimage segmentation and image splicing operations on the picture obtainedthrough photographing. If an image block splicing manner shown in FIG. 9is used, that is, an entire picture is segmented and then image blocksare spliced, overall definition of the document image can be improved.

It should be noted that FIG. 9 is merely an example provided in thisembodiment of the present invention and is used to describe thisembodiment of the present invention, but shall not constitute anylimitation.

To avoid impairment of near-end definition of the document image whileimproving the far-end definition of the document image, this embodimentof the present invention provides the following implementations.

In some embodiments, as shown in FIG. 10, the mobile device may move thephotographing focus a plurality of times in the direction close to thefar-end content in the document image, and sequentially obtain, throughphotographing, the n (n≥2) pictures in a process of moving the focus.

The three pictures shown in FIG. 9 are used as an example. The picture 1is taken after the first time of focus moving, the picture 2 is takenafter the second time of focus moving, and the picture 3 is taken afterthe third time of focus moving. When the picture 1 is taken, the focusis still relatively close to near-end content, and image definition nearthe near-end content is still relatively high. Therefore, when the imagesegmentation and image splicing operations are performed on the threepictures, a to-be-spliced image block of the near-end content may beselected from the picture 1. In this way, near-end definition of apicture obtained through splicing is less affected by focus moving.

In some embodiments, as shown in FIG. 11, before resetting the locationof the photographing focus, the mobile device may further take one ormore pictures. Reference may be made to step S108. In this case, thephotographing focus is usually set at an image center by default. Then,after the location of the photographing focus is reset, n (n=1 or n≥2)pictures are taken. Finally, image correction may be applied based onthe pictures obtained through photographing (including the picture takenbefore focus resetting and the n pictures), as described in step S105.The image correction step described in step S105 is not only used forrestoring the geometric ratio of the document image, but also used forfurther improving the far-end definition of the document image by usingthe image processing method shown in FIG. 9. The following providesdetailed descriptions. Step S105 may include the following steps:

Step 1: Apply geometric correction to at least two of the picturesobtained through photographing (including the picture taken before focusresetting and the n pictures).

Step 2: Divide, into m image blocks, each of the at least two picturesto which geometric correction has been applied, where m≥2, and m is apositive integer.

Step 3: With respect to a same image block, select, from the at leasttwo pictures, an image block with highest definition as a to-be-splicedimage block.

Finally, m selected to-be-spliced image blocks are spliced into onepicture, and the picture obtained through splicing is used as the outputin response to the photographing instruction.

It can be understood that, because a picture has been taken before thephotographing focus is reset, near-end definition of the picture takenbefore the photographing focus is reset is not affected by focus moving,and the definition is quite high. Therefore, when the image segmentationand image splicing operations are performed by using all the picturesobtained through photographing (including the picture taken before focusresetting and the n pictures), a to-be-spliced image block of thenear-end content may be selected from the picture taken before focusresetting. In this way, near-end definition of a picture obtainedthrough splicing is not affected by focus moving.

In some embodiments, to further improve the far-end definition of thedocument image, the mobile device may alternatively perform, beforeapplying geometric correction, image segmentation and image splicingoperations on the pictures obtained through photographing (including thepicture taken before focus resetting and the n pictures), then applygeometric correction to one picture obtained through splicing, and use,as the output in response to the photographing instruction, the pictureto which geometric correction has been applied.

In implementation of the embodiment in FIG. 4 or FIG. 11, duringphotographing of the target document, if a relatively large inclinationangle is found between the image plane of the camera and the targetdocument through analysis, the camera is triggered to move thephotographing focus toward the far-end content in the document image andtake a picture, and finally, geometric correction is applied to thepicture obtained through photographing, to obtain a corrected documentimage. The foregoing solution can significantly increase the definitionof the far-end content in the document image, and improve correctionquality of the document image.

FIG. 12 shows another processing method according to an embodiment ofthe present invention. In the embodiment in FIG. 12, duringphotographing of a target document, if a relatively large inclinationangle is found between an image plane of a camera and the targetdocument through analysis, the camera is triggered to enter the presetphotographing mode described in the foregoing Solution 2. Steps S201 toS213 are performed by a mobile device or at least one processor in amobile device. The mobile device includes but is not limited to a mobilephone, a camera, a wearable device, or a network camera. The followingprovides descriptions by using an example in which the mobile device isan execution body.

S201: The mobile device receives a photographing instruction.

S203: The mobile device determines, through edge detection, four sidesk₁, k₂, k₃, and k₄ of a document image corresponding to the targetdocument in a preview box of the mobile device.

S205: The mobile device determines, based on the four sides, a firstincluded angle corresponding to the document image, where the firstincluded angle may be used to represent an inclination degree of thedocument image relative to the target document. Specifically, the firstincluded angle is positively correlated with a photographing inclinationangle. The photographing inclination angle is an inclination angle ofthe image plane of the camera relative to the target document. Referringto content in FIG. 2A and FIG. 2B, it can be learned that the imageplane of the camera is a plane on which the document image is located,and the photographing inclination angle is the included angle α in FIG.2A and FIG. 2B.

For specific implementation of determining the first included angle,refer to related content in the embodiment in FIG. 4. Details are notdescribed herein again.

S207: The mobile device determines whether the first included angle isgreater than a preset threshold. Specifically, if the first includedangle is greater than the preset threshold, execution of step S209 istriggered; if the first included angle is not greater than the presetthreshold, execution of step S213 is triggered.

S209: The mobile device takes k pictures, where k≥2, and k is a positiveinteger. In this case, a photographing focus is usually set at an imagecenter by default, or may be set at another location. This is notlimited herein.

S211: The mobile device applies image correction by using the k pictures(k≥2) obtained through photographing, and uses, as output in response tothe photographing instruction, a picture obtained through imagecorrection. Herein, image correction is used for improving far-enddefinition of the document image, so that far-end definition of thepicture obtained through image correction is higher than the far-enddefinition of the document image obtained by the camera in step S203.

For specific implementation of performing image correction by using aplurality of (k) pictures, refer to FIG. 9 and related content. Detailsare not described herein again.

Specifically, image correction can not only restore a geometric ratio ofthe document image, but also improve the far-end definition of thedocument image.

S213: The mobile device applies geometric correction to the documentimage. For specific implementation of geometric correction, refer toFIG. 2 and related content.

It can be understood that, when step S209 is performed, slight jitter ofthe camera causes the k pictures obtained through photographing topresent different far-end definition. Far-end content of some of thepictures is clearer. Therefore, when image segmentation and imagesplicing operations are performed by using the k pictures obtainedthrough photographing, an image block with highest definition may beselected from the k pictures as a to-be-spliced image block. This canimprove definition of far-end content in the document image.

It should be noted that the mobile device in steps S201 to S213 may bereplaced by a processor in the mobile device, and details are notdescribed herein.

It should be noted that, for content not mentioned in the embodiment inFIG. 12, refer to the foregoing embodiments. Details are not describedherein again.

The following describes a mobile device provided in an embodiment of thepresent invention. The mobile device may be a smart digital camera, or amobile device having an image acquisition function, for example, amobile phone; may be a network camera apparatus, for example, an IPcamera; or may be another device having an image acquisition function.Referring to FIG. 2, the mobile device 100 may include a camera 20, amain processor 101, a memory 102 (one or more computer readable storagemedia), an input/output system 30, an external storage system 40, and acommunications module 50. All the parts shown in the figure maycommunicate over one or more communications buses 114, for example, anI2C bus or GPIO.

The camera 20 may include a lens 21, an imaging part 23, and an imagesignal processor (ISP: Image Signal Processor) 25. The imaging part 23converts, into an electrical signal, an optical image captured by thelens 21. The image signal processor 25 is configured to convert, into adigital signal, the electrical signal that is input from the imagingpart 23, perform further image processing on the converted-to digitalsignal, and then transmit the processed digital signal to the mainprocessor 101 by using a camera interface 29. In some embodiments, theimage signal processor 27 may alternatively be integrated into the mainprocessor 101. In some embodiments, the camera 20 may further include alens drive part 25, configured to move the lens 21 to adjust a locationof a photographing focus. In specific implementation, the lens drivepart 25 may be a voice coil motor (VCM: Voice Coil Motor), or may be aclosed loop motor, an alternate motor, an OIS (optical imagestabilization, English: Optical Image Motor) motor, or the like.

The input/output system 30 is mainly configured to implement a functionof interaction between the mobile device 100 and a user/an externalenvironment. In specific implementation, the input/output system 30 mayinclude but is not limited to: a user input interface 107; a keyboard115, a mouse 116, a touchscreen 117, and an audio frequency circuit 118that are connected to the user input interface 107, for example, a userinput apparatus such as a microphone; a peripheral output interface 108;and a display 119 and the audio frequency circuit 118 that are connectedto the peripheral output interface 108, for example, an output apparatussuch as a loudspeaker.

The external storage system 40 is mainly configured to provide removableexternal storage for the mobile device 100, to meet a flexible storagerequirement of a user. In specific implementation, the external storagesystem 40 may include but is not limited to: an external storageinterface 106, and a removable storage device, such as an SD memory card112, a magnetic disk 113, and a USB flash drive 114, connected to theexternal storage interface 106. In actual use, a user may transfer databetween the mobile device 100 and an external storage device. Forexample, the user stores, into the external storage device, a picturetaken by the camera 20. For another example, the user transfers apicture in the external storage device to the mobile device 100, and mayview the picture by using the display 119.

The communications module 50 is configured to communicate with anexternal communications device. In specific implementation, thecommunications module 50 may include but is not limited to a networkinterface 105, and a Wi-Fi module 111 connected to the network interface105. The network interface 105 may support a wireless network protocolsuch as 802.11. In actual application, the communications module 50 mayfurther include another communications part. For example, in anembodiment in which the mobile device 100 is a mobile phone, thecommunications module 50 may further include a mobile communicationsmodule, for example, a 3G communications module.

The main processor 101 may integrate and include one or more CPUs, aclock module, and a power management module. The clock module is mainlyconfigured to generate, for the main processor 101, a clock required fordata transmission and time sequence control. The power management moduleis mainly configured to provide stable and high-precision voltage forthe main processor 101, the camera 20, the communications module 50, andthe input/output system 30.

The memory 102 is coupled to the main processor 101, and is configuredto store various software programs and/or multiple groups ofinstructions, and program data. In specific implementation, the memory102 may include a high-speed random access memory, and may also includea nonvolatile memory. The memory 102 may further store an operatingsystem, for example, an embedded operating system such as Android, iOS,Windows, or Linux.

The following describes in detail a collaboration relationship betweenthe foregoing parts in the embodiments of the present invention.Reference may be made to FIG. 14.

Step 1: A main processor receives a photographing instruction from atouchscreen. In specific implementation, a user may touch, on thetouchscreen, a virtual button used to simulate “photographing”, togenerate the photographing instruction. It should be noted that thephotographing instruction may alternatively come from another part, forexample, a physical button used for photographing. This is not limitedherein.

Step 2: The main processor triggers a camera to capture a document imageof a target document. Specifically, an imaging part in the cameracaptures the document image of the target document, and outputs anelectrical signal of the document image to an ISP in the camera.

Step 3: The ISP converts, into image data of the document image, theelectrical signal that is input by the camera, and sends the image datato the main processor.

Step 4: The main processor performs edge detection on the documentimage, to identify four sides of the document image that is possiblypresented as an arbitrary quadrilateral.

Step 5: The main processor determines, based on the four sidesidentified through edge detection, a first included angle correspondingto the document image.

Step 6: The main processor determines whether the first included angleis greater than a preset threshold; and if the first included angle isgreater than the preset threshold, triggers a lens drive part, forexample, a voice coil motor, to move a lens in the camera to adjust alocation of a photographing focus; or if the first included angle isless than the preset threshold, directly applies geometric correction tothe document image, to restore a geometric ratio of the document image.

Step 7: The lens drive part drives the lens to move, and notifies themain processor after moving is completed.

Step 8: The main processor sends the photographing instruction to thecamera, to trigger the camera to take one or more pictures.Specifically, the imaging part in the camera captures the document imageof the target document, and outputs an electrical signal of the documentimage to the ISP in the camera.

Step 9: The ISP generates image data of the one or more pictures, andreturns the image data of the one or more pictures to the mainprocessor.

Step 10: The main processor may apply geometric correction by using theone or more pictures obtained through photographing.

Finally, the main processor may display a corrected document image byusing the touchscreen.

It should be noted that an inter-part collaboration process described inFIG. 14 is corresponding to the method embodiment in FIG. 4. For themethod embodiments in FIG. 11 and FIG. 12, proper adjustment (addition,deletion, or change) may be performed on some interaction processes inFIG. 14, to adapt to a plurality of implementations.

For example, for the method embodiment in FIG. 11, in the foregoing step6, if the main processor determines that the first included angle isgreater than the preset threshold, the main processor may first triggerthe ISP to take one or more pictures, and then trigger the lens drivepart to move the lens in the camera.

For example, for the method embodiment in FIG. 12, because the locationof the photographing focus does not need to be reset, the lens drivepart in FIG. 14 may not be used. In addition, in the foregoing step 6,if the main processor determines that the first included angle isgreater than the preset threshold, the main processor triggers the ISPto obtain a plurality of pictures, and no longer triggers the lens drivepart to move the lens to adjust the focus location. In addition, theforegoing step 7 needs to be deleted to adapt to the method embodimentin FIG. 12.

It should be noted that, for a definition of the first included angle,specific implementation of determining the first included angle, andspecific implementation of performing image correction by using the oneor more pictures, reference may be made to the foregoing methodembodiments. Details are not described herein again.

It should be noted that FIG. 13 is merely an implementation of thisembodiment of the present invention. In actual application, the mobiledevice 100 may alternatively include more or fewer parts. This is notlimited herein.

FIG. 15 is a schematic structural diagram of a mobile device accordingto an embodiment of the present invention. The mobile device may be asmart digital camera, or a mobile device having an image acquisitionfunction, for example, a mobile phone; may be a network cameraapparatus, for example, an IP camera; or may be another device having animage acquisition function. The mobile device is configured to implementthe processing method described in the foregoing method embodiment. Asshown in FIG. 15, the mobile device 150 may include an input unit 151,an edge detection unit 152, a determining unit 153, a judging unit 154,a focus setting unit 155, a photographing unit 156, and a correctionunit 157.

The input unit 151 is configured to receive a photographing instruction.Specifically, the photographing instruction is used to trigger thephotographing unit 156 to photograph a target document.

The edge detection unit 152 is configured to identify, through edgedetection, four sides k₁, k₂, k₃, and k₄ of a document imagecorresponding to the target document.

The determining unit 153 is configured to determine, based on the foursides, a first included angle corresponding to the document image. Thefirst included angle is used to represent an inclination degree of thedocument image relative to the target document. The first included angleis positively correlated with an inclination angle of an image plane ofa camera relative to the target document.

The judging unit 154 is configured to determine whether the firstincluded angle is greater than a preset threshold. If determining thatthe first included angle is greater than the preset threshold, thejudging unit 154 triggers the focus setting unit 155 to reset a focuslocation in a direction close to far-end content in the document image,and triggers the photographing unit 156 to take n (n is a positiveinteger) pictures. Specifically, the focus setting unit 155 may beconfigured to set the focus location. The photographing unit 156 isconfigured to take the n pictures.

The correction unit 157 is configured to apply geometric correction byusing the picture obtained through photographing by the photographingunit 156.

An output unit 158 is configured to use, as output in response to thephotographing instruction, a picture obtained through correctionperformed by the correction unit 157.

Specifically, for a definition of the first included angle and specificimplementation of determining the first included angle by thedetermining unit 153, refer to the foregoing method embodiment. Detailsare not described herein again.

In an embodiment, after the focus setting unit 155 resets the focuslocation, the photographing unit 156 may take one picture (n=1). Then,the correction unit 157 applies geometric correction by using thepicture obtained through photographing, to restore a geometric ratio ofa document image in the picture. For specific implementation ofgeometric correction, refer to content described in FIG. 3. Details arenot described herein again. It can be understood that, because thepicture is taken after the focus location is reset, far-end definitionof the document image is improved.

In an embodiment, after the focus setting unit 155 resets the focuslocation, the photographing unit 156 may take a plurality of pictures(n≥2). The correction unit 157 applies geometric correction by using theplurality of pictures obtained through photographing. Then, thecorrection unit 157 may further perform image processing shown in FIG. 9on the plurality of pictures to which geometric correction has beenapplied. For details, refer to FIG. 9 and related descriptions. Detailsare not described herein again. This can not only restore a geometricratio of the document image, but also further improve the far-enddefinition of the document image.

To avoid impairment of near-end definition of the document image whileimproving the far-end definition of the document image, thephotographing unit 156 may have the following several implementations.

In some embodiments, the photographing unit 156 may be specificallyconfigured to sequentially obtain, through photographing, the n (n≥2)pictures in a process in which the focus setting unit 155 moves aphotographing focus. When a picture is taken at an initial moment offocus moving, the focus is still relatively close to near-end content,and image definition near the near-end content is still relatively high.Therefore, when image segmentation and image splicing operations areperformed on the n pictures, a to-be-spliced image block of the near-endcontent may be selected from the picture taken at the initial moment. Inthis way, near-end definition of a picture obtained through splicing isless affected by focus moving.

In some embodiments, the photographing unit 156 may be specificallyconfigured to take one or more pictures before the focus setting unit155 resets the location of a photographing focus. Near-end definition ofthe picture taken before the photographing focus is reset is notaffected by focus moving. Therefore, when image segmentation and imagesplicing operations are performed by using all the pictures obtainedthrough photographing (including the picture taken before focusresetting and the n pictures), a to-be-spliced image block of thenear-end content may be selected from the picture taken before focusresetting. In this way, near-end definition of a picture obtainedthrough splicing is not affected by focus moving.

In an embodiment of another processing method provided in theembodiments of the present invention, if determining that the firstincluded angle is greater than the preset threshold, the judging unit154 may trigger the photographing unit 156 to take k (k≥2, and k is apositive integer) pictures. Correspondingly, the correction unit 157 maybe configured to apply geometric correction by using the k picturesobtained through photographing by the photographing unit 156. Then, thecorrection unit 157 may further perform image processing shown in FIG. 9on the plurality of pictures to which geometric correction has beenapplied. For details, refer to FIG. 9 and related descriptions. Detailsare not described herein again.

It can be understood that, when the photographing unit 156 takes the kpictures, slight jitter of the camera causes the k pictures obtainedthrough photographing to present different far-end definition. Far-endcontent of some of the pictures is clearer. Therefore, when thecorrection unit 157 performs image segmentation and image splicingoperations by using the plurality of pictures obtained throughphotographing, an image block with highest definition may be selectedfrom the plurality of pictures as a to-be-spliced image block. This canimprove definition of far-end content in the document image.

For specific implementation of performing image correction by thecorrection unit 157 by using one or more pictures, and other contentunmentioned in the embodiment in FIG. 15, refer to the foregoing methodembodiments. Details are not described herein again.

To sum up, according to the embodiments of the present invention, duringphotographing of the target document (to-be-photographed object), if arelatively large inclination angle is found between the image plane ofthe camera and the target document through analysis, the camera istriggered to enter the preset photographing mode described in theforegoing Solution 1 or Solution 2, and finally, image correction isperformed by using the picture obtained through photographing. Thepreset photographing mode is used to improve a document image far-endfuzziness status caused by the relatively large inclination angle. Theforegoing solution can significantly increase the definition of thefar-end content in the document image, and improve correction quality ofthe document image.

A person skilled in the art should understand that the embodiments ofthe present invention may be provided as a method, a system, or acomputer program product. Therefore, the present invention may use aform of hardware-only embodiments, software-only embodiments, orembodiments with a combination of software and hardware. Moreover, thepresent invention may use a form of a computer program product that isimplemented on one or more computer-usable storage media (including butnot limited to a magnetic disk memory, an optical memory, and the like)that include computer-usable program code.

The present invention is described with reference to the flowchartsand/or block diagrams of the method, the device (system), and thecomputer program product according to the embodiments of the presentinvention. It should be understood that computer program instructionsmay be used to implement each process and/or block in the flowchartsand/or the block diagrams, and a combination of a process and/or a blockin the flowcharts and/or the block diagrams. These computer programinstructions may be provided for a general-purpose computer, a dedicatedcomputer, an embedded processor, or a processor of another programmabledata processing device to generate a machine, so that the instructionsexecuted by the computer or the processor of another programmable dataprocessing device generate an apparatus configured to implement aspecified function in one or more processes in the flowcharts and/or inone or more blocks in the block diagrams.

These computer program instructions may be alternatively stored in acomputer readable memory that can instruct a computer or anotherprogrammable data processing device to work in a specific manner, sothat the instructions stored in the computer readable memory generate anartifact that includes an instruction apparatus. The instructionapparatus implements a specified function in one or more processes inthe flowcharts and/or in one or more blocks in the block diagrams.

These computer program instructions may be alternatively loaded onto acomputer or another programmable data processing device, so that aseries of operation steps are performed on the computer or the anotherprogrammable device, thereby generating computer-implemented processing.Therefore, the instructions executed on the computer or the anotherprogrammable device provide steps for implementing a specified functionin one or more processes in the flowcharts and/or in one or more blocksin the block diagrams.

Apparently, a person skilled in the art may make various modificationsand variations to the present invention without departing from thespirit and scope of the present invention. Therefore, the presentinvention is intended to cover these modifications and variationsprovided that these modifications and variations of the presentinvention fall within the scope of the claims of the present inventionand equivalent technologies thereof.

What is claimed is:
 1. A processing method, applied to an electronicdevice, the processing method comprising: receiving a photographinginstruction; determining, through edge detection, four sides of adocument image corresponding to a target document in a preview box ofthe electronic device; determining, based on a set of ratios calculatedusing the four sides or based on a set of angles calculated using thefour sides, a first included angle corresponding to the document image,wherein the first included angle represents an inclination degree of thedocument image relative to the target document, and wherein the firstincluded angle is positively correlated with an inclination angle of animage plane of a camera relative to the target document; triggering thecamera to reset a focus location in a direction of far-end content inthe document image and taking n pictures when the first included angleis greater than a preset threshold, wherein n is an integer greater thanor equal to one; applying geometric correction to at least one of the npictures; and outputting, in response to the photographing instruction,the at least one of the n pictures to which the geometric correction hasbeen applied.
 2. The processing method of claim 1, wherein when thefirst included angle is determined based on the set of ratios,determining the first included angle comprises: obtaining lengths k₁,k₂, k₃, and k₄ of the four sides, wherein k₁ and k₃ correspond toopposite sides, wherein k₁/k₃≥one, wherein k₂ and k₄ correspond toopposite sides, and wherein k₂/k₄≥one; calculating side ratios of twopairs of opposite sides, wherein side ratios are k₁/k₃ and k₂/k₄;determining either k₁ as a main side when k₁/k₃ is greater than k₂/k₄ ork₂ as the main side when k₂/k₄ is greater than k₁/k₃; and determining,as the first included angle, an included angle formed by intersection oftwo lateral sides of the main side.
 3. The processing method of claim 1,wherein when the first included angle is determined based on the set ofangles, determining the first included angle comprises: obtaininglengths k₁, k₂, k₃, and k₄ of the four sides, wherein k₁ and k₃correspond to opposite sides, and wherein k₂ and k₄ correspond toopposite sides; calculating a second included angle formed between k₁and k₃ and a third included angle formed between k₂ and k₄; anddetermining, as the first included angle, a larger of the secondincluded angle and the third included angle.
 4. The processing method ofclaim 3, wherein n≥two, and wherein triggering the camera to reset thefocus location in the direction of the far-end content in the documentimage and taking the n pictures comprises: moving a photographing focusin the direction of the far-end content in the document image; andobtaining the n pictures through photographing.
 5. The processing methodof claim 3, wherein n≥two, and wherein triggering the camera to resetthe focus location in a direction of the far-end content in the documentimage and taking the n pictures comprises: moving a photographing focust times in the direction of the far-end content in the document image;and taking at least one picture each time after moving the photographingfocus, wherein t is an integer greater than or equal to one and lessthan or equal to n.
 6. The processing method of claim 5, wherein beforetriggering the camera to reset the focus location in the direction ofthe far-end content in the document image, the processing method furthercomprises taking at least one picture.
 7. The processing method of claim1, wherein triggering the camera to reset the focus location in thedirection of the far-end content in the document image comprises:calculating an angle difference between the first included angle and thepreset threshold; determining a moving distance of a photographing focusbased on the angle difference; and moving the photographing focus in thedirection of the far-end content in the document image by the movingdistance.
 8. A processing method, applied to a mobile device, theprocessing method comprising: receiving a photographing instruction;determining, through edge detection, four sides of a document imagecorresponding to a target document in a preview box of the mobiledevice; determining, based on a set of ratios calculated using the foursides or based on a set of angles calculated using the four sides, afirst included angle corresponding to the document image, wherein thefirst included angle represents an inclination degree of the documentimage relative to the target document, and wherein the first includedangle is positively correlated with an inclination angle of an imageplane of a camera relative to the target document; triggering the camerato take k pictures when the first included angle is greater than apreset threshold, wherein k≥two, and wherein k is a positive integer;applying image correction to the k pictures obtained throughphotographing; and outputting, in response to the photographinginstruction, one picture obtained through the image correction, whereinfar-end content in the picture obtained through the image correction isclearer than far-end content in the document image.
 9. The processingmethod of claim 8, wherein when the first included angle is determinedbased on the set of ratios, determining the first included anglecomprises: obtaining lengths k₁, k₂, k₃, and k₄ of the four sides,wherein k₁ and k₃ correspond to opposite sides, wherein k₁/k₃≥one,wherein k₂ and k₄ correspond to opposite sides, and wherein k₂/k₄≥one;calculating side ratios of two pairs of opposite sides, wherein sideratios are k₁/k₃ and k₂/k₄; determining either k₁ as a main side whenk₁/k₃ is greater than k₂/k₄ or k₂ as the main side when k₂/k₄ is greaterthan k₁/k₃; and determining, as the first included angle, an includedangle formed by intersection of two lateral sides of the main side. 10.The processing method of claim 8, wherein when the first included angleis determined based on the set of angles, determining the first includedangle comprises: obtaining lengths k₁, k₂, k₃, and k₄ of the four sides,wherein k₁ and k₃ correspond to opposite sides, and wherein k₂ and k₄correspond to opposite sides; calculating a second included angle formedbetween k₁ and k₃ and a third included angle formed between k₂ and k₄;and determining, as the first included angle, a larger of the secondincluded angle and the third included angle.
 11. The processing methodof claim 10, wherein applying the image correction to the k picturescomprises: applying geometric correction to at least two of the kpictures; dividing, into m image blocks, each of the at least two of thek pictures to which the geometric correction has been applied, whereinm≥two, and wherein m is a positive integer; selecting, with respect to asame image block from the at least two of the k pictures, an image blockwith a highest definition as a to-be-spliced image block; performingimage splicing on m selected to-be-spliced image blocks; and setting, asan output, one picture obtained through splicing.
 12. The processingmethod of claim 10, wherein applying the image correction to the kpictures comprises: dividing each of at least two of the k pictures intom image blocks, wherein m≥two, and wherein m is a positive integer;selecting, with respect to a same image block from the at least two ofthe k pictures, an image block with highest definition as ato-be-spliced image block; performing image splicing on m selectedto-be-spliced image blocks; obtaining one picture through splicing;applying geometric correction to the one picture; and outputting the onepicture to which the geometric correction has been applied in responseto the photographing instruction.
 13. A mobile device, comprising: abutton configured to receive a photographing instruction; a cameracoupled to the button and configured to obtain a document image of atarget document; and a processor coupled to the button and the cameraand configured to: determine, through edge detection, four sides of thedocument image corresponding to the target document in a preview box ofthe mobile device; determine, based on a set of ratios calculated usingthe four sides or based on a set of angles calculated using the foursides, a first included angle corresponding to the document image,wherein the first included angle represents an inclination degree of thedocument image relative to the target document, and wherein the firstincluded angle is positively correlated with an inclination angle of animage plane of the camera relative to the target document; determinewhether the first included angle is greater than a preset threshold;trigger the camera to reset a focus location in a direction of far-endcontent in the document image and take n pictures, wherein the firstincluded angle is greater than the preset threshold, and wherein n is aninteger greater than or equal to one; apply geometric correction to atleast one of the n pictures obtained through photographing; and output,in response to the photographing instruction, the at least one of the npictures to which the geometric correction has been applied.
 14. Themobile device of claim 13, wherein the n≥two, and wherein the camera isfurther configured to: move a photographing focus in the direction ofthe far-end content in the document image; and obtain the n picturesthrough photographing.
 15. The mobile device of claim 13, wherein n≥two,and wherein the camera is further configured to: move a photographingfocus t times in the direction of the far-end content in the documentimage; and take at least one picture each time after moving thephotographing focus, wherein t is an integer greater than or equal toone and less than or equal to n.
 16. The mobile device of claim 15,wherein the camera is further configured to take at least one picturebefore resetting the focus location in a direction of the far-endcontent in the document image.
 17. The mobile device of claim 13,wherein the button comprises a virtual button or a physical button. 18.A mobile device, comprising: a button configured to receive aphotographing instruction; a camera coupled to the button and configuredto obtain a document image of a target document; a processor coupled tothe button and the camera and configured to: determine, through edgedetection, four sides of the document image corresponding to the targetdocument in a preview box of the mobile device; determine, based on aset of ratios calculated using the four sides or based on a set ofangles calculated using the four sides, a first included anglecorresponding to the document image, wherein the first included anglerepresents an inclination degree of the document image relative to thetarget document, and wherein the first included angle is positivelycorrelated with an inclination angle of an image plane of the camerarelative to the target document; determine whether the first includedangle is greater than a preset threshold; trigger the camera to take kpictures, wherein the first included angle is greater than the presetthreshold, wherein k≥two, and wherein k is a positive integer; applyimage correction to the k pictures; and output, in response to thephotographing instruction, one picture obtained through the imagecorrection, wherein far-end content in the picture obtained through theimage correction is clearer than far-end content in the document image.19. The mobile device of claim 18, wherein the processor is furtherconfigured to: apply geometric correction to the k pictures; divide,into m image blocks, each of the k pictures to which the geometriccorrection has been applied, wherein m≥two, and wherein m is a positiveinteger; select, with respect to a same image block from the k pictures,an image block with highest definition as a to-be-spliced image block;perform image splicing on m selected to-be-spliced image blocks; andset, as the output, one picture obtained through splicing.
 20. Themobile device of claim 18, wherein the processor is further configuredto: divide each of the k pictures into m image blocks, wherein m≥two,and wherein m is a positive integer; select, with respect to a sameimage block from the k pictures, an image block with highest definitionas a to-be-spliced image block; perform image splicing on m selectedto-be-spliced image blocks; obtain one picture obtained throughsplicing; apply geometric correction to the one picture; and output theone picture to which the geometric correction has been applied.